{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Exercise: DSLs and Code generation with Loopy (open-ended)\n",
    "\n",
    "1. Define a small domain-specific language for image processing. Operations you could support include:\n",
    "    * `blur(n, img)`: To keep things simple, take an average of the neighboring $n\\times n$ pixels.\n",
    "    * `mask(x, y, width, height)`. (`loopy` supports `if(condition, then, else)`, which maps to an `If(cond, then, else)` node in pymbolic.)\n",
    "    * Blending and nonlinear filtering using arithmetic\n",
    "2. Using your language, implement a filter that blurs the top left quarter of an image\n",
    "3. Implement your language \"conventionally\", using functions and loopy kernels\n",
    "4. Implement your language by capturing an expression tree and executing that.\n",
    "5. Think of and try to implement (at least) one optimization you could apply to the expression tree. You may use [Halide](http://halide-lang.org/) as inspiration if you like."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
